# -*- coding: utf-8 -*-
# @Time    : 2021/4/22 17:34
# @Author  : 夏思毅
# @Email   : 2739124228@qq.com
# @File    : requests三创网站爬虫图片.py
# @Software: PyCharm

import requests,re
result = requests.get("http://www.sanchuangedu.cn/")
# print(result.text)
ret = re.findall(r"(?<=img\ssrc=\").*(?=\"\salt)",result.text)
count=1
for i in ret:
    picture = requests.get("https://www.sanchuangedu.cn"+i)
    with open(f"picture{count}.jpg","ab") as f:
        f.write(picture.content)
        count+=1
        print(count,"已完成")
